$(function(){
    article.sub_event();
	article.form_check();
});

article={
    form_check:function(){
		$("#form").validate();
	},
	sub_event:function(){
        $('#form input:submit').click(function(){
            var content=UE.getEditor('editor').getContent();
            content=encodeURIComponent(content);
            $('#form').submit(function(){return false});
            global_obj.subEvent($('#form input:submit'),global_obj.webmaster+'/article/edit_action/',$('#form').serialize()+'&Contents='+content,function(data){
                window.location.href = global_obj.webmaster+'/article/index/'+data.msg.gid+'/'+data.msg.page+'/';
            },function(data){
                Box.alertBox(data.msg.notice,function(){
                    $('#form input:submit').attr('disabled',false);
                });
            });
        });
    }
}